//
//  UIButton+Extension.swift
//  iOSSinaWeb
//
//  Created by yws on 16/5/20.
//  Copyright © 2016年 yws. All rights reserved.
//

import UIKit

extension UIButton{
    convenience init(bkgImageName: String,imageName: String, title: String, titleColor: UIColor = UIColor.lightGrayColor(), fontSize: CGFloat = 12) {
        self.init(type: UIButtonType.Custom)
        setBackgroundImage(UIImage(named: bkgImageName), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: "\(bkgImageName)_highlighted"), forState: UIControlState.Highlighted)
        
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(titleColor, forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
    }
}
